/**
 * Copyright 2012 Fonfon.Fenceer
 * All rights reserved.
 * 
 * @project 
 * @author Fonfon.Fenceer
 * @version 1.0
 * @data 2012-3-9
 */
package com.guidecaptain.common.validatecode.service.impl;

import org.apache.commons.lang.StringUtils;

import com.guidecaptain.common.validatecode.service.ValidateCodeService;
import com.guidecaptain.core.common.CookieManager;

/**
 * 验证码服务接口
 * 
 * @author fonfon
 */
public class ValidateCodeServiceImpl implements ValidateCodeService {

	/**
	 * 检查验证码是否正确
	 * 
	 * @param cookieManager
	 * @param code
	 * @return
	 */
	public boolean isCheckValidateCode(CookieManager cookieManager, String code) {

		String ccode = cookieManager.getCookieValue("validateCode");
		System.out.println(code+"//"+ccode);
		if (StringUtils.isBlank(code) || !code.toUpperCase().equals(ccode)) {
			return false;
		} else {
			return true;
		}

	}

}